package com.www.applyword.utils;

import android.view.View;
import android.view.ViewStub;
import android.widget.ImageView;
import android.widget.TextView;

import com.www.applyword.R;


/**
 * @author yjyvi
 * @data 2018/4/16.
 * 显示空布局
 */

public class EmptyListUtils {

    public static void loadEmpty(boolean flag,  ViewStub viewStub,int type) {
        if (viewStub.getParent() != null) {
            View view = viewStub.inflate();
            ImageView imageView = (ImageView) view.findViewById(R.id.img_empty);
            TextView tv_empty = (TextView) view.findViewById(R.id.tv_empty);
            if (type == 0 ){
                imageView.setImageResource(R.mipmap.no_order);
                tv_empty.setText("暂无相关信息");
            }else if (type == 1){  //收藏
                imageView.setImageResource(R.mipmap.enshrine);
                tv_empty.setText("还没有收藏，赶快去收藏一波吧~");
            }else if (type == 2){  //动态
                imageView.setImageResource(R.mipmap.dynamin);
                tv_empty.setText("还还没有动态，快去发布吧~");
            }else if (type == 3){
                imageView.setImageResource(R.mipmap.no_order);
                tv_empty.setText("暂无好友申请");
            }else if (type == 4){
                imageView.setImageResource(R.mipmap.no_order);
                tv_empty.setText("暂无通讯录好友");
            }else if (type == 5){
                imageView.setImageResource(R.mipmap.no_order);
                tv_empty.setText("暂无群聊信息");
            }else {
                imageView.setImageResource(R.mipmap.no_order);
                tv_empty.setText("暂无黑名单信息");
            }
        }

        if (flag) {
            viewStub.setVisibility(View.VISIBLE);
        } else {
            viewStub.setVisibility(View.GONE);
        }
    }
}
